package ws.jdbc.concurrent.driver.sqlserver.cursor.wrapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Provides services to create different types of cursors.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public interface ICursorFactory {

  /** Create a cursor for a result set of type {@link ResultSet#TYPE_FORWARD_ONLY} and concurrency of {@link ResultSet#CONCUR_READ_ONLY}.
   *
   * @return created cursor.
   *
   * @throws SQLException if some database error prevents from determining the result set type and concurrency.
   * @throws JdbcConcurrentException if the result set type is not {@link ResultSet#TYPE_FORWARD_ONLY} and the concurrency is not {@link ResultSet#CONCUR_READ_ONLY}.
   */
  ICursorForwardReadOnly createForwardRead() throws SQLException;

  /** Create a cursor for a result set of type {@link ResultSet#TYPE_FORWARD_ONLY} and concurrency of {@link ResultSet#CONCUR_UPDATABLE}.
   *
   * @return created cursor.
   *
   * @throws SQLException if some database error prevents from determining the result set type and concurrency.
   * @throws JdbcConcurrentException if the result set type is not {@link ResultSet#TYPE_FORWARD_ONLY} and the concurrency is not {@link ResultSet#CONCUR_UPDATABLE}.
   */
  ICursorForwardUpdate createForwardUpdate() throws SQLException;

  /** Create a cursor for a result set of type {@link ResultSet#TYPE_SCROLL_INSENSITIVE} or {@link ResultSet#TYPE_SCROLL_SENSITIVE} and concurrency of {@link ResultSet#CONCUR_READ_ONLY}.
   *
   * @return created cursor.
   *
   * @throws SQLException if some database error prevents from determining the result set type and concurrency.
   * @throws JdbcConcurrentException if the result set type is not {@link ResultSet#TYPE_SCROLL_INSENSITIVE} or {@link ResultSet#TYPE_SCROLL_SENSITIVE} and the concurrency is not {@link ResultSet#CONCUR_READ_ONLY}.
   */
  ICursorScrollReadOnly createScrollRead() throws SQLException;

  /** Create a cursor for a result set of type {@link ResultSet#TYPE_SCROLL_INSENSITIVE} or {@link ResultSet#TYPE_SCROLL_SENSITIVE} and concurrency of {@link ResultSet#CONCUR_UPDATABLE}.
   *
   * @return created cursor.
   *
   * @throws SQLException if some database error prevents from determining the result set type and concurrency.
   * @throws JdbcConcurrentException if the result set type is not {@link ResultSet#TYPE_SCROLL_INSENSITIVE} or {@link ResultSet#TYPE_SCROLL_SENSITIVE} and the concurrency is not {@link ResultSet#CONCUR_UPDATABLE}.
   */
  ICursorScrollUpdate createScrollUpdate() throws SQLException;
}
